package hottargui.view;

import hottargui.domain.*;
import minidraw.framework.*;
import java.awt.Point;
import java.awt.event.*;

/** A tool to roll the die.



 */

public class MyAttackRollDieTool extends RollDieTool {

	private Point _startPoint;
	private Game _game;
	private boolean _skipAttack; 


	public MyAttackRollDieTool(DrawingEditor editor, Game game) {
		super(editor, game);
		this._game = game;
	}
	public void mouseDown(MouseEvent evt, int x, int y) {

		_startPoint = new Point(x,y);

		Position
		boardStartPosition = mouse2pos(_startPoint);

		_skipAttack =
			boardStartPosition.getColumn() <= 6;	

		if (_skipAttack)
			_game.endAttack();
		else      
			super.mouseDown(evt, x, y);
	}
	/** convert a mouse position to board position */
	private Position mouse2pos(Point p) {
		Position
		pos =
			TarguiViewDefinition.getTilePositionFromXY(p.x, p.y);
		return pos;
	}  
}

